#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e5 + 5;

int n, m1, m2;
pii a[N];
int sum1[N], sum2[N];
void solve(int m, pii a[N], int sum[]) {
  rep(i, 0, n) sum[i] = 0;
  sort(a + 1, a + m + 1);                               // 先到先处理
  priority_queue<int, vector<int>, greater<int>> idle;  // cand
  priority_queue<pii, vector<pii>, greater<pii>> used;
  rep(i, 1, n) idle.push(i);
  rep(i, 1, m) {
    while (used.size() && used.top().first < a[i].first) {
      idle.push(used.top().second);
      used.pop();
    }
    if (idle.size()) {  // 有可用廊桥
      int x = idle.top();
      idle.pop();
      sum[x]++;
      used.push(pii(a[i].second, x));
    }
  }
  rep(i, 1, n) sum[i] += sum[i - 1];
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m1 >> m2;
  rep(i, 1, m1) cin >> a[i].first >> a[i].second;
  solve(m1, a, sum1);
  rep(i, 1, m2) cin >> a[i].first >> a[i].second;
  solve(m2, a, sum2);
  int ans = 0;
  rep(i, 0, n) {
    int j = n - i;
    ans = max(ans, sum1[i] + sum2[j]);
  }
  cout << ans;
  return 0;
}